home *** CD-ROM | disk | FTP | other *** search
- /*
- ### draw a circle ###
-
- Bug: need to work on it: circle is not really a circle!
- */
-
- #include <suntool/sunview.h>
- #define SQRT2 1.4142135623730950
- static int npts[1] = {8};
- static struct pr_pos vlist[8];
-
- circle(pw,xp,yp,s,color,p_type)
- Pixwin *pw;
- int xp,yp,s,color,p_type;
- {
- int s2;
-
- s2 = s/SQRT2;
- vlist[0].x = s;
- vlist[0].y = 0;
- vlist[1].x = s2;
- vlist[1].y = s2;
- vlist[2].x = 0;
- vlist[2].y = s;
- vlist[3].x = -s2;
- vlist[3].y = s2;
- vlist[4].x = -s;
- vlist[4].y = 0;
- vlist[5].x = -s2;
- vlist[5].y = -s2;
- vlist[6].x = 0;
- vlist[6].y = -s;
- vlist[7].x = s2;
- vlist[7].y = -s2;
- if(p_type==0){
- pw_polygon_2(pw,xp,yp,1,npts,vlist,PIX_SRC | PIX_COLOR(color),0,0,0);
- }
- else {
- pw_polygon_2(pw,xp,yp,1,npts,vlist,PIX_SRC ^ PIX_DST | PIX_COLOR(color),0,0,0);
- }
- }
-